package com.example.dairenkun.neufoodshop.model;

import com.example.dairenkun.neufoodshop.bean.Login;
import com.example.dairenkun.neufoodshop.bean.User;
import com.example.dairenkun.neufoodshop.service.LoginService;
import com.example.dairenkun.neufoodshop.service.RegisterService;
import com.example.dairenkun.neufoodshop.service.UserService;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Administrator on 2017/4/19.
 */

public class UserModel {
    //1
    private Retrofit retrofit;
    public UserModel(){
       retrofit=new Retrofit.Builder()
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://60.205.189.39/")
                .build();

    }
    //登录
    public  Call Login(String strname,String strpass){
        LoginService service=retrofit.create(LoginService.class);
         return  service.getLogin(strname,strpass);
    }
    //注册
    public  Call Register(String strname,String strpass,String strphone,String straddres,String strremake)
    {
        RegisterService service=retrofit.create(RegisterService.class);
        return  service.Register( strname, strpass,strphone, straddres,strremake);
    }
    //y用户信息
    public Call UserInfo(int userid){
        UserService testService=retrofit.create(UserService.class);
        return testService.getUserInfo(userid);
    }

}
